<template>
  <div class="footer">
    <div class="w1420">
      <div class="top flexRow Xbetween Ycenter">
        <div class="left flexRow Xbetween">
          <span class="pointer" @click="goto('introduce')">赛事介绍</span>|
          <span class="pointer" @click="goto('review')">往届回顾</span>|
          <span class="pointer" @click="goto('current')">作品展示</span>|
          <span class="pointer" @click="goto('about')">联系我们</span>
        </div>
        <div class="center flexCol Xbetween">
          <div class="img-part flexRow Ycenter">
            <img src="../assets/img/phone.png" alt />
            <span>24小时热线</span>
          </div>
          <div>{{ info.phone_400 }}</div>
          <div>{{ info.phone }}</div>
        </div>
        <div class="right">
          <img :src="info.wechart_img" alt />
        </div>
      </div>
      <div class="bottom">
        <span class="pointer" @click="goto">{{ info.case_number }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import { footerData } from '../api/home'
import { setCookie } from '../utils/auth'
export default {
  name: 'Footer',
  data() {
    return {
      info: {}
    }
  },
  computed: {
    nowReviewId: {
      get() {
        return this.$store.getters.nowReviewId
      }
    },
    activePath: {
      get() {
        return this.$store.state.settings.activePath
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'activePath',
          value: val
        })
        setCookie('path', val)
      }
    }
  },
  mounted() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      footerData().then((res) => {
        this.info = res.data
        this.$store.dispatch('user/setLogo', this.info.logo)
      })
    },
    goto(path) {
      if (path) {
        if (path == 'review') {
          this.$router.push({
            path: '/' + path,
            query: { id: this.nowReviewId }
          })
          this.activePath = '/' + path + '?id=' + this.nowReviewId
        } else {
          this.$router.push({
            path: '/' + path
          })
          this.activePath = '/' + path
        }
      } else {
        window.open('https://beian.miit.gov.cn/')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.footer {
  height: 482px;
  background: #262626;
  box-sizing: border-box;
  .top {
    height: 200px;
    color: #ffffff;
    padding: 100px 0 79px;
    border-bottom: 1px solid #333333;
    .left {
      font-size: 24px;
      width: 595px;
    }
    .right img {
      width: 200px;
      height: 100%;
    }
    .center {
      height: 100%;
      padding: 19px 0;
      box-sizing: border-box;
      margin-left: 80px;
      font-size: 36px;
      font-weight: 800;
      .img-part {
        img {
          width: 48px;
          height: 48px;
          margin-right: 15px;
        }
        span {
          font-size: 24px;
          font-weight: 400;
        }
      }
    }
  }
  .bottom {
    font-size: 20px;
    color: #999999;
    line-height: 102px;
    text-align: center;
  }
}
</style>